package com.ncell.cell;

public class PConnection {

    private final P p;
    private float weight;

    public PConnection(P p) {
        this.p = p;
    }

    public boolean isActive() {
        return p.isActive();
    }

    public boolean isConnectedToActive() {
        return p.isConnectedToActive();
    }

    public float getWeight() {
        return weight;
    }

    public PConnection setWeight(float weight) {
        if (weight > 1) {
            weight = 1;
        }
        this.weight = weight;
        return this;
    }

    public void addWeight(float weightDelta) {
        weight += weightDelta;
        if (weight > 1) {
            weight = 1;
        }
    }

    public P getP() {
        return p;
    }
}
